﻿//界面遮罩层
//fastCSharp.OverDiv.Show();
(function(){
var OverDiv=function()
	{
	this.GetArgument(arguments[0],{Color:'#444444',Opacity:90},1);
	this.Id='fastCSharpOverDiv'+this.SysId;
	this.Ids=[];
	};
(fastCSharp.Functions.OverDiv=OverDiv).Inherit(fastCSharp.BaseFunction,{
Show:function(Id,ZIndex)
	{
	if(Id)	{
		if(this.Ids.length)
			{
			if(this.Ids[this.Ids.length-1].Id!=Id)
				{
				var Index=this.Ids.IndexOf(function(Value){return Value.Id==Id;},1);
				if(Index+1)	this.Ids.splice(Index,1);
				var Value=this.Ids[this.Ids.length-1],Element=fastCSharp.$Id(Value.Id);
				if(!Value.ZIndex)	this.Ids[this.Ids.length-1].ZIndex=Element.Css('zIndex')||0;
				Element.Css('zIndex',-100);
				this.Ids.push({Id:Id,ZIndex:ZIndex||0});
				}
			}
		else	this.Ids.push({Id:Id,ZIndex:ZIndex||0});
		}
	var Element=fastCSharp.$Id(this.Id);
	if(Element.Count())	Element.Display(1);
	else	this.$Create('div').Css('zIndex',fastCSharp.OverZIndex).Css('position','fixed').Css('top,left','0px').Css('width,height','100%').Css('backgroundColor',this.Color).Opacity(this.Opacity).Id(this.Id).To();
	},
Hide:function(Id)
	{
	if(Id)	{
		if(this.Ids.length)
			{
			if(this.Ids[this.Ids.length-1].Id==Id)
				{
				this.Ids.pop();
				if(this.Ids.length)
					{
					var Value=this.Ids[this.Ids.length-1];
					fastCSharp.$Id(Value.Id).Css('zIndex',Value.ZIndex);
					}
				}
			else	this.Ids.Remove(function(Value){return Value.Id==Id;},1);
			}
		}
	else	{
		while(this.Ids.length)
			{
			var Value=this.Ids.pop();
			fastCSharp.$Id(Value.Id).Css('zIndex',Value.ZIndex);
			}
		}
	if(!this.Ids.length)	fastCSharp.$Id(this.Id).Display(0);
	}
		});
fastCSharp.OverDiv=new fastCSharp.Functions.OverDiv();
})();